<?php

global $_GPC;
global $_W;
$shopid = check_right(2);
if (!$shopid) {
    message('请先选择需要管理的店铺', $this->createWebUrl('shop'), 'error');
}
$shop = pdo_fetch('SELECT * FROM ' . tablename('j_hmoney_group') . ' WHERE weid = \'' . $_W['uniacid'] . '\' and id=\'' . $shopid . '\'');
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
$cfg = $this->module['config'];
if (!($operation == 'display' || $operation == 'charge')) {
    if ($operation == 'getinfo') {
        $condition = ' and groupid =\'' . $shopid . '\' ';
        intval($_GPC['datetype']);
        switch (intval($_GPC['datetype'])) {
            case 1:
                break;
            case 2:
                break;
            case 3:
                break;
            case 4:
                break;
        }
        if (isset($_GPC['paytype'])) {
            $condition .= ' and paytype = \'' . $_GPC['paytype'] . '\' ';
        }
        $notmember = pdo_fetch('SELECT count(*) as num1,sum(total_fee) as fee1,sum(num) as num2 FROM ' . tablename('j_hmoney_order') . ' WHERE weid=\'' . $_W['uniacid'] . '\' ' . $condition . ' and memberno=0 and ispay=1');
        $member = pdo_fetch('SELECT count(*) as num1,sum(total_fee) as fee1,sum(num) as num2 FROM ' . tablename('j_hmoney_order') . ' WHERE weid=\'' . $_W['uniacid'] . '\' ' . $condition . ' and memberno>0 and ispay=1');
        exit(json_encode(array('success' => true, 'notmember' => $notmember, 'member' => $member)));
    }
}
include $this->template('web/' . $cfg['floder'] . '/salemember');